export function setTophtml(data) {
  let tophtml = "";
  tophtml =
      "<table  style='width: 100%;border-collapse: collapse'>" +
      "<tbody>" +
      "<tr >" +
      "<th  colSpan='1' rowSpan='1' width='auto'>收款节点</th>" +
      "<th  colSpan='1' rowSpan='1' width='auto'>收款比例</th>" +
      "<th  colSpan='1' rowSpan='1' width='auto'>收款金额</th>" +
      "<th  colSpan='1' rowSpan='1' width='700'>说明备注</th>" +
      "</tr>";
  data.map(item => {
    tophtml +=
        "<tr style='height: 20px'>" +
        `<td  colSpan='1' rowSpan='1' width='auto'>${item.receiveTaskName || ""}</td>` +
        `<td  colSpan='1' rowSpan='1' width='auto'>${item.receiveTaskScale || ""}</td>` +
        `<td  colSpan='1' rowSpan='1' width='auto'>${item.receiveMoney || ""}</td>` +
        `<td  colSpan='1' rowSpan='1' width='auto'>${item.receiveTaskRemark || ""}</td>` +
        "</tr>";
  });
  tophtml += "</tbody>" + "</table><br>";
  return tophtml;
}

export function setBottomhtml(data) {
  let bottomhtml = "";
  bottomhtml =
      "<table  style='width: 100%;border-collapse: collapse;'>" +
      "<tbody>" +
      "<tr >" +
      "<th  colSpan='1' rowSpan='1' width='auto'>收款节点</th>" +
      "<th  colSpan='1' rowSpan='1' width='auto'>收款比例</th>" +
      "<th  colSpan='1' rowSpan='1' width='auto'>收款金额</th>" +
      "<th  colSpan='1' rowSpan='1'  width='700'>说明备注</th>" +
      "</tr>";
  data.map(items => {
    bottomhtml +=
        "<tr style='height: 20px'>" +
        `<td  colSpan='1' rowSpan='1' width='auto'>${items.receiveTaskName || ""}</td>` +
        `<td  colSpan='1' rowSpan='1' width='auto'>${items.receiveTaskScale || ""}</td>` +
        `<td  colSpan='1' rowSpan='1' width='auto'>${items.receiveMoney || ""}</td>` +
        `<td  colSpan='1' rowSpan='1' width='auto'>${items.receiveTaskRemark || ""}</td>` +
        "</tr>";
  });
  bottomhtml += "</tbody>" + "</table><br>";
  return bottomhtml;
}

// 横版
export function setHtml(data, flag) {
  let html = "";
  let str = flag ? "crossA4List" : "verticalA4List";
  data.spaceList.forEach(i => {
    if (i.quotaItemList && i.quotaItemList.length > 0) {
      // 表头
      html +=
          `<p style="font-size: 16px;font-weight: 600">${i.spaceName}（合计：${i.spaceTotalMoney || ""}）</span><span>面积:${i.area || ""}平方米   长：${i.length || ""}  宽：${i.width || ""}  高：${i.height || ""}</p>` +
          "<table style='width: 100%;border-collapse: collapse;border: 1px solid #ccc;margin-top: 10px;margin-bottom: 10px'>" +
          "<tbody>" +
          "<tr style='background: #f5f2f0'>" +
          "<th style='border: 1px solid #ccc;'  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>序号</th>";
      if (data.configViewVO[str].find(item => item.coloumFields === "mainPicUrl").val === 1) {
        html += "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>图片</th>";
      }

      html +=
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>商品名称</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>品牌</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>型号</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>单位</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>数量</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>耗损率</th>";
      if (data.configViewVO[str].find(item => item.coloumFields === "productUnitPrice").val === 1) {
        html += "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>材料单价</th>";
      }
      if (data.configViewVO[str].find(item => item.coloumFields === "workerUnitPrice").val === 1) {
        html += "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>人工费单价</th>";
      }
      if (data.configViewVO[str].find(item => item.coloumFields === "unitTotalMoney").val === 1) {
        html += "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>单项合计</th>";
      }
      if (data.configViewVO[str].find(item => item.coloumFields === "projectTotalMoney").val === 1) {
        html += "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>汇总合计</th>";
      }
      html +=
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>预算工程量</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>材料及工艺说明</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>备注</th>";
      html += "</tr>";
      i.quotaItemList &&
      i.quotaItemList.forEach((k, index) => {
        html += "<tr>" + `<td style='border: 1px solid #ccc;'  colSpan='1' rowSpan='1' width='auto'>${index + 1 || ""}</td>`;
        if (data.configViewVO[str].find(item => item.coloumFields === "mainPicUrl").val === 1) {
          html += `<td style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'><img style="width: 60px;height: 60px;margin: 5px" src="${k.mainPicUrl || ""}" alt=""/></td>`;
        }
        html +=
            "<td  style='border: 1px solid #ccc;word-break: break-all;word-wrap: break-word;' colSpan='1' rowSpan='1' width='auto'>";
        if (k.productName) {
          if ([7, 8].includes(k.quotaType)) {
            html += "[<span style='color: #007DFF'>个性化</span>]";
          }
          if (k.isCustom === 1) {
            html += "[<span style='color: #51cb53'>定制</span>]";
          }
          html += `${k.productName || ""}`;
        }
        html +=
            "</td>" +
            `<td  style='border: 1px solid #ccc;word-break: break-all;word-wrap: break-word;' colSpan='1' rowSpan='1' width='auto'>${k.brandName || ""}</td>` +
            `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${k.modeCode || ""}</td>` +
            `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${k.productUnit || ""}</td>` +
            `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${k.type == 3 ? "/" : k.num}</td>` +
            `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${k.lostRate || ""}</td>`;
        if (data.configViewVO[str].find(item => item.coloumFields === "productUnitPrice").val === 1) {
          html += `<td  style='border: 1px solid #ccc; 'colSpan='1' rowSpan='1' width='auto'>${k.productUnitPrice || ""}</td>`;
        }
        if (data.configViewVO[str].find(item => item.coloumFields === "workerUnitPrice").val === 1) {
          html += `<td style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${k.workerUnitPrice || ""}</td>`;
        }
        if (data.configViewVO[str].find(item => item.coloumFields === "unitTotalMoney").val === 1) {
          html += `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${k.unitTotalMoney || ""}</td>`;
        }
        if (data.configViewVO[str].find(item => item.coloumFields === "projectTotalMoney").val === 1) {
          html += `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${k.projectTotalMoney || ""}</td>`;
        }
        html +=
            `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${k.projectVal || ""}</td>` +
            `<td  style='border: 1px solid #ccc;word-break: break-all;word-wrap: break-word;' colSpan='1' rowSpan='1' width='auto'>${k.standardDesc || ""}</td>` +
            `<td class="remark"   style='border: 1px solid #ccc;word-break: break-all;word-wrap: break-word;' colSpan='1' rowSpan='1' width='auto'>${removeImg(k.remark) || ""}</td>` +
            "</tr>";
      });
      html += "</tbody></table>";
    }
    if (i.specialQuotaItemList && i.specialQuotaItemList.length > 0) {
      html +=
          "<p style='font-size: 16px;font-weight: 600'>个性化增项</p><table style='width: 100%;border-collapse: collapse;'>" +
          "<tbody>";
      // 表头
      html +=
          "<tr style='background: #f5f2f0'>" +
          "<th style='border: 1px solid #ccc;'  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>序号</th>";
      if (data.configViewVO[str].find(item => item.coloumFields === "mainPicUrl").val === 1) {
        html += "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>图片</th>";
      }
      html +=
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>商品名称</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>品牌</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>型号</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>单位</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>数量</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>耗损率</th>";
      if (data.configViewVO[str].find(item => item.coloumFields === "productUnitPrice").val === 1) {
        html += "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>材料单价</th>";
      }
      if (data.configViewVO[str].find(item => item.coloumFields === "workerUnitPrice").val === 1) {
        html += "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>人工费单价</th>";
      }
      if (data.configViewVO[str].find(item => item.coloumFields === "unitTotalMoney").val === 1) {
        html += "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>单项合计</th>";
      }
      if (data.configViewVO[str].find(item => item.coloumFields === "projectTotalMoney").val === 1) {
        html += "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>汇总合计</th>";
      }
      html +=
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>预算工程量</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>材料及工艺说明</th>" +
          "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>备注</th>" +
          "</tr>";
      i.specialQuotaItemList.forEach((g, index) => {
        // 表头
        html += "<tr>" + `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${index + 1 || ""}</td>`;
        if (data.configViewVO[str].find(item => item.coloumFields === "mainPicUrl").val === 1) {
          html += `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'><img style="width: 60px;height: 60px" src="${g.mainPicUrl || ""}" alt=""/></td>`;
        }
        html +=
            "<td  style='border: 1px solid #ccc;word-break: break-all;word-wrap: break-word;' colSpan='1' rowSpan='1' width='auto'>";

        if (g.productName) {
          if (g.isCustom === 1) {
            html += "[<span style='color: #51cb53'>定制</span>]";
          }
          html += `${g.productName || ""}`;
        }
        html += "</td>";
        html +=
            `<td  style='border: 1px solid #ccc;word-break: break-all;word-wrap: break-word;' colSpan='1' rowSpan='1' width='auto'>${g.brandName || ""}</td>` +
            `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${g.modeCode}</td>` +
            `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${g.productUnit || ""}</td>` +
            `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${g.num || ""}</td>` +
            `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${g.lostRate || ""}</td>`;
        if (data.configViewVO[str].find(item => item.coloumFields === "productUnitPrice").val === 1) {
          html += `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${g.productUnitPrice || ""}</td>`;
        }
        if (data.configViewVO[str].find(item => item.coloumFields === "workerUnitPrice").val === 1) {
          html += `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${g.workerUnitPrice || ""}</td>`;
        }
        if (data.configViewVO[str].find(item => item.coloumFields === "unitTotalMoney").val === 1) {
          html += `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${g.unitTotalMoney || ""}</td>`;
        }
        if (data.configViewVO[str].find(item => item.coloumFields === "projectTotalMoney").val === 1) {
          html += `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${g.projectTotalMoney || ""}</td>`;
        }
        html +=
            `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${g.projectVal || ""}</td>` +
            `<td  style='border: 1px solid #ccc;word-break: break-all;word-wrap: break-word;' colSpan='1' rowSpan='1' width='auto'>${g.standardDesc || ""}</td>` +
            `<td class="remark"  style='border: 1px solid #ccc;word-break: break-all;word-wrap: break-word;' colSpan='1' rowSpan='1' width='auto'>${removeImg(g.remark) || ""}</td>` +
            "</tr>";
      });
      html += "</tbody></table>";
    }
    if (i.remark) {
      html += `<span class="remark"  style="display: flex;align-items: center;">备注：${removeImg(i.remark) || ""}</span>`;
    }
  });

  return html;
}

export function siveHtml(data, moneyType) {
  // 综合项

  let siveHtmlDowm = "";
  if (data.comprehensiveList && data.comprehensiveList.length > 0) {
    siveHtmlDowm +=
        `<p>综合项（合计：${data.comprehensiveFee || ""}）</p>` +
        "<table style='width: 100%;border-collapse: collapse;border: 1px solid #ccc;margin-top: 10px;margin-bottom: 10px'>" +
        "<tbody><tr style='background: #f5f2f0'>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>序号</th>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>项目名称</th>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>属性</th>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>关联报价</th>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>基数</th>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>单价/比例</th>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>总价</th>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>说明备注</th>" +
        "</tr>";
    data.comprehensiveList.forEach(i => {
      siveHtmlDowm +=
          "<tr>" +
          `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${i.serialNo || ""}</td>` +
          `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${i.itemName || ""}</td>` +
          `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${getType(moneyType, i.moneyType)}</td>` +
          `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${i.linkTypesDesc || ""}</td>` +
          `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${i.originItemMoney || ""}</td>` +
          `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${i.feeRate || ""}</td>` +
          `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${i.itemMoney || ""}</td>` +
          `<td  style='border: 1px solid #ccc;' colSpan='1' rowSpan='1' width='auto'>${i.remark || ""}</td>` +
          "</tr>";
    });
    siveHtmlDowm += "</tbody></table>" + `<p>管理费：${data.manageFee || ""}</p><p>税金费用：${data.taxesFee || ""}</p>`;
  }
  return siveHtmlDowm;
}

export function setbudget(data) {
  // 预算汇总表
  let budgetHtml = "";
  if (data?.budgetSummaryVO?.itemList && data?.budgetSummaryVO?.itemList.length > 0) {
    budgetHtml +=
        `<p>预算汇总表</p>` +
        "<table style='width: 100%;border-collapse: collapse;border: 1px solid #ccc;margin-top: 10px;margin-bottom: 10px'>" +
        "<tbody><tr style='background: #f5f2f0'>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>序号</th>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>类别名称</th>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>计算明细</th>" +
        "<th style='border: 1px solid #ccc;'   colSpan='1' rowSpan='1' width='auto'>价格</th>" +
        "</tr>";
    data.budgetSummaryVO.itemList.forEach(i => {
      budgetHtml +=
          "<tr>" +
          `<td  style='border: 1px solid #ccc;'colSpan='1' rowSpan='1' width='auto'>${i.serialNo || ""}</td>` +
          `<td  style='border: 1px solid #ccc;'colSpan='1' rowSpan='1' width='auto'>${i.itemName || ""}</td>` +
          `<td  style='border: 1px solid #ccc;'colSpan='1' rowSpan='1' width='auto'>${i.itemDesc || ""}</td>` +
          `<td  style='border: 1px solid #ccc;'colSpan='1' rowSpan='1' width='auto'>${i.amount || ""}</td>` +
          "</tr>";
    });
    budgetHtml += "</tbody></table>";
    if (data?.concludeRemark) {
      budgetHtml += `<p>备注：${data?.concludeRemark || ""} </p>`;
    }
    budgetHtml += `<p>合同成交金额：${data?.budgetTotlalMoney || ""} </p>`;
    return budgetHtml;
  }
}

const getType = (type, code) => {
  if (code) {
    return type.find(i => i.dictValue == code)?.dictLabel;
  } else {
    return "";
  }
};

// 软装预算报价
export function setTableHtml(data, unit) {
  let html = "";
  data.spaceList.forEach(item => {
    if (item.quotaProductDetailsList.length > 0) {
      html += `<p style="font-size: 18px;font-weight: 600">${item.spaceName}（合计：${item.spaceTotalMoney || ""}）</p>`;
      html +=
          "<table style='width: 100%;border-collapse: collapse;border: 1px solid #ccc;margin-top: 10px;margin-bottom: 10px'>" +
          "<tbody>" +
          "<tr style='background: #f5f2f0'>" +
          "<th>分类</th>" +
          "<th style='border: 1px solid #ccc;' >分类</th>" +
          "<th style='border: 1px solid #ccc;' >品牌</th>" +
          "<th style='border: 1px solid #ccc;' >型号</th>" +
          "<th style='border: 1px solid #ccc;' >商品规格</th>" +
          "<th style='border: 1px solid #ccc;' >单位</th>" +
          "<th style='border: 1px solid #ccc;' >数量</th>" +
          "<th style='border: 1px solid #ccc;' >商品备注</th>" +
          "<th style='border: 1px solid #ccc;' >正价/合计金额</th>" +
          "<th style='border: 1px solid #ccc;' >特价/合计金额</th>" +
          "<th style='border: 1px solid #ccc;' >单项小计</th></tr>";
      item.quotaProductDetailsList &&
      item.quotaProductDetailsList.forEach(i => {
        html +=
            `<tr><td style='border: 1px solid #ccc;' >${i.firstCategoryName || ""}</td>` +
            "<td style='border: 1px solid #ccc;' >";
        if (i.lastCategoryName) {
          if ([7, 8].includes(i.quotaType)) {
            html += "[<span style='color: #007DFF'>个性化</span>]";
          }
          if (i.isCustom === 1) {
            html += "[<span style='color: #51cb53'>定制</span>]";
          }
          html += `${i.lastCategoryName || ""}`;
        }
        html +=
            "</td>" +
            `<td style='border: 1px solid #ccc;word-break: break-all;word-wrap: break-word;' >${i.brandName || ""}</td>` +
            `<td style='border: 1px solid #ccc;' >${i.modeCode || ""}</td>` +
            `<td style='border: 1px solid #ccc;' >${i.skuSpecification || ""}</td>` +
            `<td style='border: 1px solid #ccc;' >${getUnit(unit, i.productUnit)}</td>` +
            `<td style='border: 1px solid #ccc;' >${i.productNum || ""}</td>` +
            `<td style='border: 1px solid #ccc;' >${i.remark || ""}</td>` +
            `<td style='border: 1px solid #ccc;' >${i.totalClientPrice || ""}</td>` +
            `<td style='border: 1px solid #ccc;' >${i.totalClientPreferentialPrice || ""}</td>` +
            `<td style='border: 1px solid #ccc;' >${i.totalMoney || ""}</td></tr>`;
      });
      html += "</tbody></table>";
      if (item.remark) {
        html += `<div style="display: flex"><p>备注：</p>${item.remark || ""}</div>`;
      }
    } else {
      if (item.remark) {
        html += `<p>${item.spaceName}（合计：${item.spaceTotalMoney || ""}）</p>`;
        html += `<div style="display: flex"><p>备注：</p>${item.remark || ""}</div>`;
      }
    }
  });
  html += `<p>房屋测量总面积  <span> 总面积：${data.houseArea || ""}㎡</span></p>`;
  return html + setHtmlSum(data.aggregationVOList, data);
}

const setHtmlSum = (data, obj) => {
  let budgetType = obj.budgetType;
  if (data && data.length > 0) {
    let sumNum = 0;
    for (let i = 0; i < data.length; i++) {
      sumNum = sumNum += Number(data[i].totalClientPrice) + Number(data[i].totalClientPreferentialPrice);
      data[i].rowspan = 1;
      data[0].sumNum = sumNum.toFixed(2);
      for (let j = i + 1; j < data.length; j++) {
        if (data[i].categoryName === data[j].categoryName) {
          data[j].show = true;
          data[i].rowspan = data[i].rowspan += 1;
        }
      }
    }
  }
  let html = "";
  html += "<p style='font-size: 18px;font-weight: 600'>个性化汇总明细</p>";
  html +=
      "<table style='width: 100%;border-collapse: collapse;border: 1px solid #ccc;margin-top: 10px;margin-bottom: 10px'><tbody>" +
      "<tr style='background: #f5f2f0'>" +
      "<th style='border: 1px solid #ccc;' >分类</th>" +
      "<th style='border: 1px solid #ccc;' >正价/合计金额</th>" +
      "<th style='border: 1px solid #ccc;' >特价/合计金额</th>" +
      "<th style='border: 1px solid #ccc;' >总金额</th>" +
      "</tr>";
  data &&
  data.forEach((item, i) => {
    html +=
        "<tr>" +
        `<td style='border: 1px solid #ccc;'>${item.categoryName || ""}</td>` +
        `<td style='border: 1px solid #ccc;'>${item.totalClientPrice || ""}</td>` +
        `<td style='border: 1px solid #ccc;'>${item.totalClientPreferentialPrice || ""}</td>`;
    if (i === 0) {
      html += `<td style='border: 1px solid #ccc;' rowspan='${data.length}' style="text-align: center;vertical-align: middle">${item.sumNum || ""}</td></tr>`;
    }
  });
  html += "</tbody></table>";
  if (budgetType === 1) {
    // 常规
    html += `<p>房屋汇总面积：${obj.houseArea || ""} /平方  <span> 空间：${obj.spaceItemNum || ""}个</span> <span>报价项：${obj.budgetItemNum || ""}项</span></p>`;
    html += `<p>合计总造价：￥${obj.budgetTotlalMoney || ""}元  <span> 成交金额：${obj.concludeMoney || ""}元</span></p>`;
    if (obj.concludeRemark) {
      html += `<p>备注：${obj.concludeRemark || ""}</p>`;
    }
  } else {
    // 套餐
    html += `<p>成交金额：￥${obj.concludeMoney || ""} <span>备注：${obj.concludeRemark || ""}</span></p>`;
    html += `<p>套餐总价：￥${obj.budgetTotlalMoney || ""} <span>（ 超出${obj.overSquareNum || ""}平方：¥2000.00元 + 个性化增项/配：¥${obj.customIncreaseMoney || ""})</span></p>`;
    html += `<p>套餐价：￥${obj.packageUnitPrice || ""}元/米 <span>（可享受${obj.packageSquareNum || 0}米/当前${obj.houseArea || ""}米）</span><span>每多出1平方：费用按：${obj.packageOverUnitPrice || ""}元计算</span></p>`;
  }
  html += `<p>合同成交金额：${obj?.budgetTotlalMoney || ""} </p>`;
  return html;
};
const getUnit = (unit, code) => {
  if (code) {
    return unit.find(i => i.dictValue == code)?.dictLabel;
  } else {
    return "";
  }
};
const removeImg = html => {
  return html && html.replace(/<img\b[^>]*>/gi, "");
};
